<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p id="app" style="line-height: 24px; font-size: 14px;">这是一大段文字文字，<span style="font-size: 24px;">这是一大段文字</span>，这是一大段文字文字</p>

</body>
<script>

    const div = document.querySelector('#app')
    // div.style.color = 'red'
    // div.style.fontSize = '30px'
    const range = document.createRange()
    range.selectNode(div)
     range.setStart(div, 1)
    range.setEnd(div, 2)
        const rects = range.getClientRects();
    console.log(rects)
    const bd = range.getBoundingClientRect()
   
    console.log(bd)
</script>
</html>